﻿using AutoMapper;
using StarsAdmin.Application.Dict.Dtos;
using StarsAdmin.Application.Menu.Dtos;
using StarsAdmin.Core.DB.Entities;
using StarsAdmin.Core.Extensions;
using StarsAdmin.Core.Models;

namespace StarsAdmin.Application.Menu.Mappings
{
    public class DictAutoMapperProFile : Profile
    {
        public DictAutoMapperProFile()
        {
            CreateMap<Page<DictEntity>, Page<DictDto>>();
            CreateMap<AddDictInput, DictEntity>();
            CreateMap<UpdateDictInput, DictEntity>();
            CreateMap<DictEntity, ExportDictDto>()
                .ForMember(dest => dest.DictTypeName, opt => opt.MapFrom(src => src.DictType.Name));
            CreateMap<DictEntity, DictDto>()
                .ForMember(dest => dest.DictTypeName, opt => opt.MapFrom(src => src.DictType.Name));
        }
    }
}